package com.ys.fmms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ys.fmms.mapper.MetalDetectionMapper;
import com.ys.fmms.pojo.DataAnalysis;
import com.ys.fmms.pojo.MetalDetection;
import com.ys.fmms.service.MetalDetectionService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service(value = "metalDetectionServiceImpl")
public class MetalDetectionServiceImpl extends ServiceImpl<MetalDetectionMapper, MetalDetection> implements MetalDetectionService {
    @Override
    public MetalDetection getLast() {
        QueryWrapper<MetalDetection> wrapper = new QueryWrapper<>();
        wrapper.orderByDesc("create_time");
        wrapper.last("limit 1");
        return baseMapper.selectOne(wrapper);
    }

    @Override
    public List<DataAnalysis> getAnalysisList() {
        List<DataAnalysis> dataAnalyses = baseMapper.getAnalysisList();
        return dataAnalyses;
    }
}
